package com.example.springbootdemo.util;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.sql.Timestamp;
import java.util.Date;

public class TimestampUtil {
    private static final Logger LOGGER = LoggerFactory.getLogger(TimestampUtil.class);

    /**
     * Date 转Time方法
     *
     * @param date date
     * @return Timestamp
     */
    public static Timestamp valueOf(Date date) {
        return new Timestamp(date.getTime());
    }

    public static Date valueOf(Timestamp timestamp) {
        return new Date(timestamp.getTime());
    }
}
